package com.library.service.impl;

import java.util.HashMap;
import java.util.Map;

import com.library.bean.Admin;
import com.library.dao.AdminDao;
import com.library.dao.impl.AdminDaoImpl;
import com.library.service.AdminService;

public class AdminServiceImpl implements AdminService{

	private AdminDao adminDao = new AdminDaoImpl();

	@Override
	public Map<String, Object> login(String account, String password) {
		Map<String, Object> map = new HashMap();
		Admin loginUser = adminDao.selectUser(account, password);
		
		if(loginUser != null) {
			map.put("loginAdmin",loginUser);
			
		}else {
			loginUser=adminDao.selectAdminByAccount(account);
			if(loginUser != null) {
				map.put("msg","密码错误");
			}else {
				map.put("msg","用户不存在");
			}
		}
		return map;
	}
	
}
